@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=ZCOOL+QingKe+HuangYou&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'ZCOOL QingKe HuangYou', sans-serif;
  background: linear-gradient(-45deg, #ff9a9e, #fad0c4, #fbc2eb, #a6c1ee);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  min-height: 100vh;
  color: #333;
  overflow-x: hidden;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

header {
  text-align: center;
  padding: 50px 20px;
  position: relative;
  overflow: hidden;
}

h1 {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 3.5rem;
  margin: 0;
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeIn 1s ease-out;
}

/* 优化后的导航栏 */
nav {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 107, 107, 0.2);
  transition: background-color 0.3s ease;
}

nav.scrolled {
  background: rgba(255, 255, 255, 0.95);
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.navbar-menu {
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-item {
  position: relative;
  margin: 0 10px;
}

.navbar-link {
  display: block;
  padding: 15px 20px;
  color: #555;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  position: relative;
  transform-origin: center;
}

.navbar-link:hover {
  color: #ff6b6b;
  transform: scale(1.05);
}

.navbar-link::after {
  content: '';
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #ff6b6b;
  transition: width 0.3s ease;
}

.navbar-link:hover::after {
  width: 60%;
}

/* 新增高亮样式 */
.navbar-link.active {
  color: #ff4757 !important;
  transform: scale(1.1);
}

.navbar-link.active::after {
  width: 60% !important;
  height: 3px;
  background: #ff4757;
  border-radius: 3px;
  animation: pulse 1.5s infinite;
}

section {
  padding: 50px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

#love-timer {
  text-align: center;
  margin: 50px auto;
  padding: 40px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  max-width: 700px;
  animation: fadeIn 1s ease-out;
  position: relative;
  overflow: hidden;
}

#love-timer::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
  transform: rotate(30deg);
  z-index: -1;
}

#love-timer h2 {
  font-size: 2rem;
  margin-bottom: 30px;
  color: #ff6b6b;
}

.timer-display {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 2.2rem;
  font-weight: bold;
  color: #ff6b6b;
  margin-top: 20px;
}

.timer-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.timer-unit:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.timer-unit span:first-child {
  font-size: 3rem;
  line-height: 1;
}

.timer-unit span:last-child {
  font-size: 1.2rem;
  margin-top: 5px;
  color: #777;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px;
}

.photo-item {
  height: 250px;
  background-size: cover;
  background-position: center;
  border-radius: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.photo-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.photo-item:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.photo-item:hover::before {
  opacity: 1;
}

.love-letter {
  max-width: 800px;
  margin: 0 auto;
  padding: 50px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  animation: fadeIn 1s ease-out;
  position: relative;
}

.love-letter::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 10px;
  pointer-events: none;
}

.love-letter h2 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 30px;
  color: #ff6b6b;
}

.letter-content {
  font-size: 1.1rem;
  line-height: 1.8;
  text-align: left;
}

.letter-content p {
  margin-bottom: 20px;
  text-indent: 2em;
}

.annual-contract {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 50px;
  border-radius: 20px;
  max-width: 700px;
  margin: 50px auto;
  animation: fadeIn 1s ease-out;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.annual-contract h2 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 30px;
  color: #ff6b6b;
}

.contract-items {
  text-align: left;
  font-size: 1.1rem;
  line-height: 1.8;
  list-style-type: none;
  padding: 0;
}

.contract-items li {
  padding-left: 50px;
  position: relative;
  margin-bottom: 20px;
}

.contract-items li:before {
  content: "❤";
  position: absolute;
  left: 0;
  color: #ff6b6b;
  font-size: 28px;
  animation: pulse 1.5s infinite;
}

footer {
  text-align: center;
  padding: 30px;
  background: rgba(255, 255, 255, 0.7);
  margin-top: 50px;
  font-size: 1rem;
  color: #555;
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* 爱心飘落效果 */
.heart {
  position: fixed;
  top: -10%;
  z-index: -1;
  font-size: 20px;
  color: rgba(255, 107, 107, 0.7);
  animation-name: float;
  animation-timing-function: ease-in;
  animation-iteration-count: infinite;
  user-select: none;
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg) scale(1);
    opacity: 0;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
  
  #love-timer h2 {
    font-size: 1.8rem;
  }
  
  .timer-display {
    font-size: 1.8rem;
  }
  
  .timer-unit {
    min-width: 90px;
    padding: 10px;
  }
  
  .timer-unit span:first-child {
    font-size: 2.2rem;
  }
  
  .timer-unit span:last-child {
    font-size: 1rem;
  }
  
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  
  .photo-item {
    height: 180px;
  }
  
  .love-letter, .annual-contract {
    padding: 30px;
  }
  
  /* 导航栏优化 */
  .navbar-menu {
    flex-wrap: wrap;
  }
  
  .navbar-item {
    margin: 5px;
  }
  
  .navbar-link {
    padding: 12px 15px;
    font-size: 1rem;
  }
  
  .navbar-link.active::after {
    bottom: 5px;
    height: 2px;
    animation: none;
  }
  
  .navbar-link:hover,
  .navbar-link.active {
    transform: scale(1.05);
  }
}

/* 移动端触控优化 */
@media (max-width: 480px) {
  .navbar-link {
    padding: 10px 12px;
  }
}

/* 图片模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  overflow: auto;
}

.modal-content {
  display: block;
  margin: auto;
  max-width: 90%;
  max-height: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}
